package com.cndw.kungfu.dao;

import java.util.List;

import com.cndw.dao.jade.annotation.DAO;
import com.cndw.dao.jade.annotation.SQL;
import com.cndw.dao.jade.annotation.SQLParam;

import com.cndw.kungfu.domain.Notice;

/**
 * 运营控制模块数据库操作
 * 
 * @author fantadust
 * @date 2011-5-19 下午08:03:27
 */
@DAO
public interface IBusinessDao {

	public static final String B_NOTICE_TABLE = "kf__notice";
	public static final String B_NOTICE_FIELD = " id,title,url,initialDelay,beginTime,endTime ";

	@SQL("select " + B_NOTICE_FIELD + " from " + B_NOTICE_TABLE + " where 1=1 #if(:id>0){and id=:id } order by beginTime,id  ")
	public List<Notice> loadBusinessNotices(@SQLParam("id") int id);

	@SQL("select " + B_NOTICE_FIELD + " from " + B_NOTICE_TABLE + " order by beginTime,id  ")
	public List<Notice> loadBusinessNotices();

	@SQL("delete from " + B_NOTICE_TABLE + " where id = :id ")
	public boolean deleteNotice(@SQLParam("id") int id);

	@SQL("INSERT INTO " + B_NOTICE_TABLE + " (title,url,initialDelay,beginTime,endTime ) VALUES(:n.title,:n.url,:n.initialDelay,:n.beginTime,:n.endTime) ")
	public boolean publishNotice(@SQLParam("n") Notice notice);

	@SQL("update " + B_NOTICE_TABLE + " set title=:n.title,url=:n.url,initialDelay=:n.initialDelay,beginTime=:n.beginTime,endTime=:n.endTime where id=:n.id")
	public boolean updateNotice(@SQLParam("n") Notice notice);
}
